Add documentation for prefect sdk generate CLI#155
Conversation
- Add auto-generated CLI reference for `prefect sdk` command - Add how-to guide for generating typed SDKs from deployments - Update navigation in docs.json for both new pages - Regenerate CLI docs to include new --output options Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep only sdk.mdx from the CLI docs regeneration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The code examples reference a hypothetical my_sdk module that doesn't exist, so they can't be executed as tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove marketing-style "before/after" section - Use sentence case headers - Task-oriented organization (CLI then Python) - Add opening context and further reading links - Direct, instructional tone throughout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove marketing-style "before/after" section - Use sentence case headers - Task-oriented organization (CLI then Python) - Add opening context and further reading links - Direct, instructional tone throughout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move generate-custom-sdk.mdx to docs/v3/advanced/ - Create new "Deployments" group in Advanced section - Move form-building guide to new Deployments group - Both guides relate to deployment configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review by Qodo
1. Nonstandard logger initialization
|
| import logging | ||
| from dataclasses import dataclass, field | ||
| from datetime import datetime, timezone | ||
| from typing import TYPE_CHECKING, Any | ||
| from uuid import UUID | ||
|
|
||
| import prefect | ||
|
|
||
| # Logger for SDK fetcher operations | ||
| logger = logging.getLogger(__name__) | ||
| from prefect._sdk.models import ( |
There was a problem hiding this comment.
1. Nonstandard logger initialization 📘 Rule violation ✧ Quality
• src/prefect/_sdk/fetcher.py initializes logger via logging.getLogger(__name__) without the
required get_logger(...) pattern and without the required type annotation.
• This breaks the standardized logging configuration/type-safety requirement and can lead to
inconsistent logging behavior across modules.
• It directly violates the compliance rule that mandates `logger: "logging.Logger" =
get_logger("module_name")` for all logger instances.
Agent prompt
## Issue description
`src/prefect/_sdk/fetcher.py` creates a module logger using `logging.getLogger(__name__)` and without the required `logger: "logging.Logger" = get_logger(...)` annotation/pattern.
## Issue Context
Compliance requires consistent logger instantiation across the codebase using Prefect’s `get_logger` helper to ensure standardized configuration and type safety.
## Fix Focus Areas
- src/prefect/_sdk/fetcher.py[11-21]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| job_vars_schema: dict[str, Any] = {} | ||
| base_job_template = work_pool.base_job_template | ||
| if base_job_template and "variables" in base_job_template: | ||
| variables = base_job_template["variables"] | ||
| if isinstance(variables, dict): | ||
| job_vars_schema = variables | ||
| job_vars_schema = base_job_template["variables"] |
There was a problem hiding this comment.
2. Unchecked base_job_template variables 📘 Rule violation ⛯ Reliability
• _fetch_work_pool() assigns job_vars_schema = base_job_template["variables"] without validating the value is a dict, even though job_vars_schema is typed as dict[str, Any]. • If base_job_template["variables"] is missing expected shape (e.g., None/list/str), later code that assumes a dict (e.g., calling .get(...)) can raise runtime exceptions instead of degrading gracefully. • This violates the requirement to explicitly handle null/empty/boundary cases and potential failure points for robust behavior.
Agent prompt
## Issue description
`_fetch_work_pool()` assigns `base_job_template["variables"]` into `job_vars_schema` without verifying it is a dict, which can cause runtime errors later when code assumes dict methods like `.get()`.
## Issue Context
This value originates from API/server-provided metadata and should be treated as an external/variable-shape input. Robust handling should validate shape and degrade gracefully.
## Fix Focus Areas
- src/prefect/_sdk/fetcher.py[176-188]
- src/prefect/_sdk/renderer.py[270-276]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#1